package work20241125;

import java.util.Scanner;

/**
 * @author zdl
 * @date 2024/11/25
 */
public class Demo15 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个年份:");
        int num = sc.nextInt();
        String str = year(num);
        System.out.println(str);
    }
    //12、输入一个年份，判是闰年还是平年
    public static String year(int year){
        if (year <= 0 ){
            return "输入数据有误!";
        }else {
            if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
                return year + "年是闰年！";
            } else {
                return year + "年是平年!";
            }
        }
    }
}
